package ca.uguu.gamelib.libgdx.concepts;


import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.physics.box2d.Box2DDebugRenderer;
import com.badlogic.gdx.physics.box2d.World;

public class PhysicsScene extends SpriteScene {
	private Box2DDebugRenderer debugRenderer;
	protected World world;
	
	public PhysicsScene(){
		super();
		this.world = new World(new Vector2(), true);
	}
	
	private void renderDebug(boolean debug){
		if(debug){
			if(this.debugRenderer == null){
				this.debugRenderer = new Box2DDebugRenderer();
			}
			this.debugRenderer.render(this.world, this.camera.combined);
		}
	}
	
	@Override
	public void render(){
		this.render(null, false);
	}
	public void render(Iterable<Sprite> sprites, boolean debug){
		super.render(sprites);
		this.renderDebug(debug);
	}
	@Override
	public void render(Iterable<Sprite> sprites){
		this.render(sprites, false);
	}
	
	public World getWorld(){
		return this.world;
	}
}
